<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class CreateBookmarksTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        // 创建 网址书签模型 数据表
        Schema::create('bookmarks', function (Blueprint $table) {
            $table->id(); // 相当于 $table->bigInteger('id')->unsigned()->autoIncrement();
            $table->unsignedBigInteger('user_id')->nullable()->comment('用户ID');
            $table->string('title')->comment('标题');
            $table->string('url')->comment('网址');
            $table->unsignedSmallInteger('category_id')->nullable()->comment('所属分类ID');
            $table->text('summary')->nullable()->comment('摘要');
            $table->tinyInteger('status')->default(1)->comment('发布状态：-2软删除 -1审核不通过 0草稿 1已发布但未审核 2审核通过');
            $table->unsignedInteger('like_count')->default(0)->comment('喜欢数');
            $table->unsignedInteger('view_count')->default(0)->comment('查看数');
            $table->timestamps();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('bookmarks');
    }
}
